<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<%@ include file="/WEB-INF/views/include/easyui.jsp"%>

</head>
<body>
<div>
	<form id="mainform" action="${ctx}/shop/goods/${action}" method="post">
	<table  class="formTable">
		<tr>
			<td>名称：</td>
			<td>
			<input type="hidden" name="id" value="${id }" />
			<input name="name" type="text" value="${goods.name }" class="easyui-validatebox"  data-options="width: 180,required:'required'" />
			</td>
		</tr>
		<tr>
			<td>规格：</td>
			<td><input name="spec" type="text" value="${goods.spec}" class="easyui-validatebox" data-options="width: 180,required:'required'"/></td>
		</tr>
		<tr>
		<tr>
			<td>单位：</td>
			<td><input name="unit" type="text" value="${goods.unit}" class="easyui-validatebox" data-options="width: 180,required:'required'"/></td>
		</tr>
		<tr>
			<td>价格：</td>
			<td><input name="price" type="text" value="${goods.price}" class="easyui-validatebox" data-options="width: 180,required:'required'"/></td>
		</tr>
		<tr>
			<td>类型：</td>
			<td><input id="goodsType_id" name="goodsType.id" type="text" value="${goods.goodsType.id}" class="easyui-validatebox" data-options="width: 180,required:'required'"></td>
		</tr>
		<tr>
			<td>上架：</td>
			<td><input name="isSold" type="text" value="${goods.isSold}" class="easyui-validatebox" data-options="width: 180,required:'required'"/></td>
		</tr>
		<tr>
			<td>描述：</td>
			<td><textarea rows="5" cols="38" name="introduce" style="font-size: 12px;font-family: '微软雅黑'">${goods.introduce}</textarea></td>
		</tr>
	</table>
	</form>
</div>
<script type="text/javascript">
$(function(){	
	$('#goodsType_id').combotree({
		width:180,
		method:'GET',
	    url: '${ctx}/shop/goodsType/json',
	    idField : 'id',
	    textFiled : 'name',
	    parentField : 'pid',	  
	    animate:true
	});  
	
	$('#mainform').form({    
	    onSubmit: function(){    
	    	var isValid = $(this).form('validate');
			return isValid;	// 返回false终止表单提交
	    },    
	    success:function(data){   
	    	if(successTip(data,dg,d))
	    		dg.datagrid('reload');
	    }    
	}); 
});

</script>
</body>
</html>